<%@page import="com.AO.DAO.MaterialFoodOfSeason"%>
<%@page import="com.AO.DAO.*"%>
<%@page import="org.hibernate.criterion.Restrictions"%>
<%@page import="com.AO.DAO.HibernateSessionFactory"%>
<%@page import="org.hibernate.Criteria"%>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";

%>


<%
	String account = (String)request.getAttribute("CookerAccount");
	request.removeAttribute("CookerAccount");
	UserDAO userDao = new UserDAO();
	User user = (User)userDao.findByProperty("account", account).get(0);
	
	FoodDAO foodDao = new FoodDAO();
	Criteria criteria = HibernateSessionFactory.getSession().createCriteria(Food.class);
	criteria.add(Restrictions.eq("user.account", account));
	List foods = criteria.list();
	
 %>
<!DOCTYPE html>


<!--[if lt IE 7]> <html class="lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]>    <html class="lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]>    <html xmlns:ng="http://angularjs.org" class="lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class=""> <!--<![endif]-->

<head>
  

    <title><%=user.getNickName() %>的下厨房个人主页_下厨房</title>

    <link href="./files/favicon.ico" rel="shortcut icon" type="image/x-icon" />
  
	<link href="./files/base.d706c3c6.compress.css" rel="stylesheet" type="text/css">
	
	<link href="./files/other.0b3c792c.compress.css" rel="stylesheet" type="text/css">

</head>



<body>

<div class="popup-layer">


  
  <div class="reveal-modal-bg"></div>
  

  
<div class="reveal-modal large normal-font" id="feedbackModal">
  
  <div class="reveal-modal-title-bar">
    <div class="reveal-modal-title">意见反馈</div>
    <a href="javascript:void(0)" class="close-reveal-modal" rel="nofollow"></a>
  </div>
  <div class="reveal-modal-main">
    
    
    <form action="/feedback/create/" method="POST">
      <textarea name="feedback" rows="3"></textarea>
      <input type="hidden" name="xf" value="None">
      <input type="submit" value="提交" class="button">
    </form>
  
  
  </div>

</div>



<div class="dish-popup-bg"></div>
<div class="dish-popup" id="dishPopup">
    <div class="dish-popup-close"><img src="/pic/2013/dish_close.gif" width="64" height="64"></div>
    <div class="content page-container pure-g"></div>
</div>

<div id="report-modal"></div>

</div>

<div class="topbar-outer">
  <div class="topbar-container">
    <div class="topbar">
      



  <div class="pure-g">
    <div class="pure-u-1-6">
      <a href="/foodfood/AOHomePage..action" class="logo"><img src="./files/logo.png"></a>
    </div>
    <div class="pure-u-5-6">
      <div class="pure-g">
        <div class="pure-u-11-24">
          <form class="search" action="/foodfood/Search.action">
                                 <input type="text" name="keyword" class="typeahead float-left" data-default-text="" value="" placeholder="菜谱、食材">
                                 <input type="hidden" name="type" value="fmf">
                                 <input type="submit" value="搜索" class="button float-left">
                                </form>
        </div>
        <div class="pure-u-1-3">
          <ul class="site-nav plain pure-g">
            <li class="pure-u"><a href="index.jsp" data-ga-event="公共页面/导航栏/$text">首页</a></li>
            <li class="topbar-cats pure-u">
            <a href="/foodfood/AOMenu..action" class="block-link" data-ga-event="公共页面/导航栏/$text"><span>菜谱分类</span></a>
            <%
	            MaterialFoodTypesDAO dao=new MaterialFoodTypesDAO();
				FoodTypesDAO daof=new FoodTypesDAO();
				List<MaterialFoodTypes>list=dao.findByMaterialFoodTypeLevel(1);
				List<FoodTypes>listf=daof.findByFoodTypeLevel(1); 
				MaterialFoodOfSeasonDAO dao5=new MaterialFoodOfSeasonDAO();
				List<MaterialFoodOfSeason>list5=dao5.findAll();
			%>
            <div class="topbar-cats-submenu hidden">
              <div class="topbar-cats-submenu-bg">
              
                <ul class="plain">
                    <li class='topbar-cat-head'>常用主题</li>
                    <%
                    	int k=0;
                    	for(FoodTypes ft:listf)
                    	{
                    		if(k++==8)break;
                     %>
                    <li>
                    	<a href="/foodfood/AOFoodMenu.<%=ft.getFoodTypeId() %>.action" 
                    		title="<%=ft.getFoodTypeName() %>" 
                    		data-ga-event="公共页面/导航栏/$text"><%=ft.getFoodTypeName() %></a></li>
                   	<%} %>
                </ul>
                <ul class="plain">
					<li class="topbar-cat-head">常见食材</li>
					<% 
						k=0;for(MaterialFoodTypes ft:list)
						{if(k++==8)break;
					%>													
					<li><a href="/foodfood/AOMfoodMenu.<%=ft.getMaterialFoodTypeId() %>.action"
					title="<%=ft.getMaterialFoodTypeName() %>做法大全" data-ga-event="公共页面/导航栏/$text"><%=ft.getMaterialFoodTypeName() %></a>
					</li>
				 <%} %>
				</ul>
                	<ul class="plain">
					<li class="topbar-cat-head">时令食材</li>
					<%k=0;for(MaterialFoodOfSeason mfos:list5)						    
					{if(k++==8)break;%>
					<li><a href="/foodfood/AOMfood.<%=mfos.getMaterialFood().getMaterialFoodId() %>.action"
					title="<%=mfos.getMaterialFood().getMaterialFoodName() %>做法大全" data-ga-event="公共页面/导航栏/$text"><%=mfos.getMaterialFood().getMaterialFoodName() %></a>
					<%} %>
					</ul>                
					<div class="topbar-cats-submenu-bottom">
						<a href="/foodfood/AOMenu..action" data-ga-event="公共页面/导航栏/$text">查看全部分类</a>
					</div>
              
              </div>
            </div>
            </li>
            <li class="pure-u"><a href="/foodfood/AOFoodInMenuList..action" data-ga-event="menu.jsp">菜单</a></li>
          </ul>
        </div>
        <div class="pure-u-5-24 clearfix">

          <div class="user-action">
             		 <div class="user-action">
		              <%
							//String account = (String)session.getAttribute("account");
							String nickname = (String)session.getAttribute("nickname");
							//UserDAO userDao = new UserDAO();
							//User user = (User)userDao.findByProperty("account", account).get(0);      	
			              	if(nickname!=null)
			           		{
						%>
						<a href="/foodfood/AOCooker.<%=account%>.action"><%=nickname%></a>
						<a onclick="logout()" href="index.jsp">退出</a>
						<%
							}
			               	else
			               	{
						%>
						<a href="register.jsp" data-ga-event="公共页面/导航栏/$text">注册</a> <a
							href="login.jsp" data-ga-event="公共页面/导航栏/$text">登录</a>&nbsp;&nbsp;
						<%
							}
						%>
		
		          </div>
          </div>
        </div>
      </div>
    </div>
  </div>


    </div>
  </div>
</div>


<div class="page-outer">
  <!--begin of page-container-->
  <div class="page-container">
    



<div class="pure-g pb40">
  <!-- left avatar -->
  <div class="pure-u-5-24 people-base-left">
  <img alt="" src="<%=user.getImg() %>" style="width:180px;height:160px">
  </div>
  <!-- left avatar -->

  <!-- middle info -->
  <div class="pure-u-5-8 font12 pr30">
    <h1 class="page-title mb10">
      	<%=user.getNickName() %>的厨房
    </h1>

    <!-- basic info -->
    <div class="gray-font">
      <div>
          
            <span class="mr10 display-inline-block"><%=user.getSex() %></span>

            <span class="mr10 display-inline-block"><i class="icon-profile icon-profile-home"></i><%=user.getAddress() %></span>

          <span class="display-inline-block"><%=user.getJoinDatetime().toString().substring(0,10) %> 加入</span>
      </div>
      <div>
        
      </div>
    </div>
    <!-- basic info -->

    <!-- desc -->
      <div class="people-base-desc dark-gray-font mt10"><%=user.getPersonalitySignature() %></div>
    <!-- desc -->
  </div>
  <!-- middle info -->

  <!-- right extra -->
  <div class="pure-u-1-6 align-center people-base-right pos-r">
    <div class="people-base-follow">
          <a class="button large-button follow-button" href="/auth/login/">关注</a>
    </div>
    <div class="follow-wrap block-bg p10 pl15 pr15 pure-g w100">
      <div class="pure-u-1-2 following-num">
        <div class="font12 dark-gray-font mb10">关注的人</div>
        <div><a href="/cook/104647970/following/" class="bold font16">175</a></div>
      </div>
      <div class="pure-u-1-2">
        <div class="font12 dark-gray-font mb10">被关注</div>
        <div><a href="/cook/104647970/follower/" class="bold font16">111</a></div>
      </div>
    </div>
  </div>
  <!-- right extra -->
</div>

<!-- people profile nav -->
<div class="mb35">
  
<div class="tab-bar pure-g" id="">
  <ul id="bts" class="plain pure-g">
        <li class="active">
        <a href="javascript:void(0)" onclick="toggle(this)" name="info">
          <span>概况</span>
          </a>
        </li>
        <li>
          <a href="javascript:void(0)" onclick="toggle(this)" name="allMenus">
            <span>菜谱<%=user.getFoodMenus().size() %></span>
          </a>
        </li>
        <li>
          <a href="javascript:void(0)" onclick="toggle(this)" name="allFoods">
            <span>作品 <%=foods.size() %></span>
          </a>
        </li>
  </ul>
</div>

</div>
<!-- people profile nav -->





<div class="people-home-main">
      <!-- dishes section -->
      <div class="block" name="info">
        <h3><%=user.getNickName() %>的最近作品  <span class="font12">（<a href="javascript:void(0)" onclick="toggle(this)" name="showallFoods">查看全部<%=foods.size() %> 作品</a>）</span></h3>
        <div class="ias-container">
          
<div class="dishes-280-full-width-list">
  <ul class="plain pure-g">
      
      <%
      int i=0;
      	for(Iterator it = foods.iterator();it.hasNext();)
		{   
		    if((i++)==6){break;}
			Food food = (Food)it.next();
			
      %>
      
      <li class="pure-u">
        
	<div class="dish-280 dish-280-no-author white-bg" data-digged="false" data-id="108594837" role="dish">
	  <div class="cover">
	    <img src="<%=food.getImg() %>"  alt="<%=food.getDescription()%>" width="280" height="280">
	    <a href="/foodfood/AOFood.<%=food.getFoodId()%>.action" title="<%=food.getDescription()%>" class="link-layer cover-link"></a>
	    <%
	     	if(session==null)
	    	{
	 	%>
	 	<!-- 未登录 -->
	    <a href="login.jsp" rel="nofollow" class="plain digg-link login"></a>
	    <% }
	    	else
	    	{
	    	
	     %>
	    <a href="/auth/login/" rel="nofollow" class="plain digg-link login"></a>
	  	<%}%>
	  </div>
	  <p >
	    <a href="/foodfood/AOFood.<%=food.getFoodId()%>.action"><%=food.getFoodName() %></a>&nbsp;
	  </p>
	  <p class="desc">
	  	<%
	  		String desc = food.getDescription();
			
			if(desc.length()>65)
			{
				out.print(desc.substring(0,65)+"……");
			}else
			{
				out.print(desc);
			}
		%>
	  </p>
	  <div class="stats has-bottom-border pure-g">
	    <p class="pure-u-1-2"><%=food.getCreateDatetime().toString().substring(0,10) %></p>
	    <p class="pure-u-1-2 align-right">
	      
	    </p>
	  </div>
	</div>

      </li>
		
	  <%} %>      

     
  </ul>
</div>

        </div>
      </div>
      
            <div class="block" name="allFoods" style="display:none">
        <h3><%=user.getNickName() %>的作品</h3>
        <div class="ias-container">
          
<div class="dishes-280-full-width-list">
  <ul class="plain pure-g">
      
      <%
      	for(Iterator it = foods.iterator();it.hasNext();)
		{   
		    if((i++)==6){break;}
			Food food = (Food)it.next();
			
      %>
      
      <li class="pure-u">
        
	<div class="dish-280 dish-280-no-author white-bg" data-digged="false" data-id="108594837" role="dish">
	  <div class="cover">
	    <img src="<%=food.getImg() %>"  alt="<%=food.getDescription()%>" width="280" height="280">
	    <a href="/foodfood/AOFood.<%=food.getFoodId()%>.action" title="<%=food.getDescription()%>" class="link-layer cover-link"></a>
	    <%
	     	if(session==null)
	    	{
	 	%>
	 	<!-- 未登录 -->
	    <a href="login.jsp" rel="nofollow" class="plain digg-link login"></a>
	    <% }
	    	else
	    	{
	    	
	     %>
	    <a href="/auth/login/" rel="nofollow" class="plain digg-link login"></a>
	  	<%}%>
	  </div>
	  <p >
	    <a href="/foodfood/AOFood.<%=food.getFoodId()%>.action"><%=food.getFoodName() %></a>&nbsp;
	  </p>
	  <p class="desc">
	  	<%
	  		String desc = food.getDescription();
			
			if(desc.length()>65)
			{
				out.print(desc.substring(0,65)+"……");
			}else
			{
				out.print(desc);
			}
		%>
	  </p>
	  <div class="stats has-bottom-border pure-g">
	    <p class="pure-u-1-2"><%=food.getCreateDatetime().toString().substring(0,10) %></p>
	    <p class="pure-u-1-2 align-right">
	      
	    </p>
	  </div>
	</div>

      </li>
		
	  <%} %>      

     
  </ul>
</div>

        </div>
      </div>
      <!-- dishes section -->

      <!-- recipes section -->
      <div class="block" name="info">
        <h3><%=user.getNickName() %>的最近菜谱 <span class="font12">（<a href="javascript:void(0)" name="showallMenus" onclick="toggle(this)">查看全部 <%=user.getFoodMenus().size() %>菜谱</a>）</span></h3>
        
<div class="recipes-280-full-width-list">
  <ul class="plain pure-g">
  <%i=0;for(FoodMenu fm:user.getFoodMenus()){if((i++)==6){break;}%>
      <li class="pure-u">
        
<div class="recipe-280 white-bg">
  <div class="cover">
    <a href="/foodfood/AOFoodInMenu.<%=fm.getMenuId() %>.action" title="<%=fm.getMenuName() %>" class="image-link"><img src="<%=fm.getImg() %>" data-src="<%=fm.getImg() %>" alt="<%=fm.getMenuName() %>" width="280" height="216"></a>
  </div>
  <p class="name ellipsis red-font">
    <a href="/foodfood/AOFoodInMenu.<%=fm.getMenuId() %>.action"><%=fm.getMenuName() %></a>
  </p>
  <div class="stats ellipsis">0 做过 3 收藏 | <a href="/cook/104647970/" class="gray-link"><%=user.getNickName() %></a></div>
</div>

      </li>
      <%} %>
  </ul>
</div>

      </div>
      
      
      
            <div class="block"  name="allMenus" style="display:none">
        <h3><%=user.getNickName() %>的菜谱 </h3>
        
<div class="recipes-280-full-width-list">
  <ul class="plain pure-g">
  <%for(FoodMenu fm:user.getFoodMenus()){%>
      <li class="pure-u">
        
<div class="recipe-280 white-bg">
  <div class="cover">
    <a href="/foodfood/AOFoodInMenu.<%=fm.getMenuId() %>.action" title="<%=fm.getMenuName() %>" class="image-link"><img src="<%=fm.getImg() %>" data-src="<%=fm.getImg() %>" alt="<%=fm.getMenuName() %>" width="280" height="216"></a>
  </div>
  <p class="name ellipsis red-font">
    <a href="/foodfood/AOFoodInMenu.<%=fm.getMenuId() %>.action"><%=fm.getMenuName() %></a>
  </p>
  <div class="stats ellipsis">0 做过 3 收藏 | <a href="/cook/104647970/" class="gray-link"><%=user.getNickName() %></a></div>
</div>

      </li>
      <%} %>
  </ul>
</div>

      </div>
      <!-- recipes section -->

</div>





  </div>
  <!-- end of page-container -->
</div>

<div class="bottom-outer">
  <div class="bottom-container">
   
  </div>
</div>



  
  <script type="text/javascript" src="./files/jquery.min.js"></script>
<script type="text/javascript" src="./files/2013.anonymous.0a0601dc.compress.js"></script>


<div id='color_timer'></div>


</body>
  <script type="text/javascript">
        function toggle(t)
    {
       clickA=$(t);
       if(clickA.attr("name")=="showallFoods")
       {
         clickA=$("a[name=allFoods]");
       }
       if(clickA.attr("name")=="showallMenus")
       {
         clickA=$("a[name=allMenus]");
       }
       clickA.parent().attr("class","active");
       clickA.parent().siblings().attr("class","");
       $(".block[name="+clickA.attr("name")+"]").css("display","block");
       $(".block[name!="+clickA.attr("name")+"]").css("display","none");
    }
  </script>
</html>
